#include "Utilities.h"
#include "Trajectory.h"
#include "Trajectories.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using std::cout;
using std::endl;
using std::string;
using std::vector;
using namespace utilities;

void batchExperiment(const char* inputfile, const char* outputfile)
{
	/*
		W{10, 10, 80}, {20, 20, 60}
		D = 5, 10, 20, 30, 50, 60, 80
		p = 0.95, 0.98, 0.99
		F = 0.2, 0.3
	*/
	double Wper[3] = {0.1, 0.2, 1};
	double Wpar[3] = {0.1, 0.2, 1};
	double Wthe[3] = {0.5, 1, 5};
	double D[3] = {90.0, 85.0, 80.0};
	double p[3] = {0.95, 0.97, 0.98};
	double F[3] = {0.2, 0.25, 0.3};
	int iSizeW = 3;
	int iSizeD = 3;
	int iSizep = 3;
	int iSizeF = 3;

	string inputFileName(inputfile);
	string outputFileName(outputfile);

	for (int i = 0; i < iSizeW; ++i)	// cases of W
	{
		for (int j = 0; j < iSizeD; ++j)	//	cases of D
		{
			for (int k = 0; k < iSizep; ++k)	//	cases of p
			{

				for (int l = 0; l < iSizeF; ++l)	//	cases of F
				{
					cout << "Parameters:" << Wper[i] << "," << Wpar[i] << "," << Wthe[i] << "," << D[j] << "," << p[k] << "," << F[l] << endl;
					trajectory::Trajectories trajs(Wper[i], Wpar[i], Wthe[i], D[j], p[k], F[l]);
					trajs.readFromFile(inputFileName, 0, 1, 2);
					trajs.findOutlier();
					trajs.writeResult(outputFileName);
				}
			}
		}
	}
}

//void test(int argc, char* argv[])
//{
//	string inputFilename(argv[1]);
//	string outputFilename(argv[2]);
//	double w[3];
//	w[0] = atof(argv[3]);
//	w[1] = atof(argv[4]);
//	w[2] = atof(argv[5]);
//	double D = atof(argv[6]);
//	double p = atof(argv[7]);
//	double F = atof(argv[8]);
//
//	trajectory::Trajectories trajs(w[0], w[1], w[2], D, p, F);
//	trajs.readFromFile(inputFilename, 0, 1, 2);
//	trajs.findOutlier();
//	trajs.writeResult(outputFilename);
//}

void main(int argc, char* argv[])
{
	cout << "Begin.\n";
	//string line("aaa bbb ddd eee");
	//Split(line, ' ');
	/*double Wper = 0.1;
	double Wpar = 0.1;
	double Wthe = 0.5;
	double D = 85;
	double p = 0.98;
	double F = 0.3;
	//cout << "Please input Wper, Wpar, Wthe, D, p, F:";
	//cin >> Wper >> Wpar >> Wthe >> D >> p >> F;
	string filename("E:\\dmData\\hurricane\\test.txt"); 
	trajectory::Trajectories trajs(Wper, Wpar, Wthe, D, p, F);
	trajs.readFromFile(filename, 5, 6, 7);
	trajs.findOutlier();*/

	batchExperiment(argv[1], argv[2]);
	//test(argc, argv);
	cout << "end\n" << endl;
}
